import express from "express";
import {Router} from "express";
import {HttpRequestEven, HttpRequestEvenType} from "../event/HttpRequestEven";


const router: Router = express.Router();

router.post('/register', (req, res) => {
    const httpRequestEven = new HttpRequestEven(req, HttpRequestEvenType.REGISTER);
    httpRequestEven.createRequestProcess();
    httpRequestEven.getResult().then(result => res.json(result));
})

router.post('/logIn', (req, res) => {
    const httpRequestEven = new HttpRequestEven(req, HttpRequestEvenType.LOGIN);
    httpRequestEven.createRequestProcess();
    httpRequestEven.getResult().then(result => res.json(result));
})

router.post('/Send', (req, res) => {
    const httpRequestEven = new HttpRequestEven(req, HttpRequestEvenType.SEND);
    httpRequestEven.createRequestProcess();
    httpRequestEven.getResult().then(result => res.json(result));
})

router.post('/Get', (req, res) => {
    const httpRequestEven = new HttpRequestEven(req, HttpRequestEvenType.GET);
    httpRequestEven.createRequestProcess();
    httpRequestEven.getResult().then(result => res.json(result));
})

router.post('/CreateGroup', (req, res) => {
    const httpRequestEven = new HttpRequestEven(req, HttpRequestEvenType.CreateGroup);
    httpRequestEven.createRequestProcess();
    httpRequestEven.getResult().then(result => res.json(result));
})

router.post('/EnterGroup', (req, res) => {
    const httpRequestEven = new HttpRequestEven(req, HttpRequestEvenType.EnterGroup);
    httpRequestEven.createRequestProcess();
    httpRequestEven.getResult().then(result => res.json(result)); 
})

router.post('/BuildFriend', (req, res) => {
    const httpRequestEven = new HttpRequestEven(req, HttpRequestEvenType.BuildFriend);
    httpRequestEven.createRequestProcess();
    httpRequestEven.getResult().then(result => res.json(result)); 
})

router.post('/GetInfo', (req, res) => {
    const httpRequestEven = new HttpRequestEven(req, HttpRequestEvenType.GetInfo);
    httpRequestEven.createRequestProcess();
    httpRequestEven.getResult().then(result => res.json(result)); 
})

router.post('/GetName', (req, res) => {
    const httpRequestEven = new HttpRequestEven(req, HttpRequestEvenType.GetName);
    httpRequestEven.createRequestProcess();
    httpRequestEven.getResult().then(result => res.json(result)); 
})

export default router;